#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<map>
#include<vector>
#include<sstream>
#include<algorithm>

using namespace std;

string toLowercase(string lower)
{
	string lowerStr;
	for (auto e : lower)
	{
		if (e <= 'z' && e >= 'a' || e <= 'Z' && e >= 'A')
			lowerStr += tolower(e);
	}
	return lowerStr;
}
struct kvcompare
{
	bool operator()(const pair<string, int>& kv1, const pair<string, int>& kv2)
	{
		return kv1.second > kv2.second || (kv1.second == kv2.second && kv1.first > kv2.first);
	}
};
int main()
{
	string sentence;
	getline(cin, sentence);


	map<string, int> words;
	istringstream iss(sentence);

	string word;
	while (iss >> word)
	{
		string lowerword = toLowercase(word);
		words[lowerword]++;
	}
	vector<pair<string, int>> v(words.begin(), words.end());
	sort(v.begin(), v.end(), kvcompare());

	for (auto e : v)
	{
		cout << e.first << ":" << e.second << endl;
	}

	return 0;
}